/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.BasicInteractions;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.modeler.model.uml.Kernel.Constraint;
import edu.pku.sei.modeler.model.xml.XMLUtility;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class StateInvariant extends InteractionFragment implements IStateInvariant {
	// attributes
	
	//modified by zsj not use this attribute, instead of adding attribute includeStateInvariants in Lifeline
	protected Lifeline covered;
	
	protected Constraint invariant;
	
	
	
	
	// references
	
	
	
	// getters & setters for attributes
	
	public Lifeline getCovered() {
		return covered;
	}
	public void setCovered(Lifeline newCovered) {
		Lifeline oldcovered = covered;
		covered = newCovered;
		firePropertyChange(ModelPackage.STATEINVARIANT_COVERED, oldcovered, newCovered);
	}
	
	public Constraint getInvariant() {
		return invariant;
	}
	public void setInvariant(Constraint newInvariant) {
		Constraint oldinvariant = invariant;
		invariant = newInvariant;
		firePropertyChange(ModelPackage.STATEINVARIANT_INVARIANT, oldinvariant, newInvariant);
	}
	
	// getters for references
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.STATEINVARIANT_COVERED, covered);
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.STATEINVARIANT_INVARIANT, invariant);
		
		// references
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		covered = (Lifeline)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.STATEINVARIANT_COVERED, this);
		
		invariant = (Constraint)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.STATEINVARIANT_INVARIANT, this);
		
		// references
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.STATEINVARIANT_COVERED.equals(featureID)) {
			covered = (Lifeline)value;
		}
		
		else if(ModelPackage.STATEINVARIANT_INVARIANT.equals(featureID)) {
			invariant = (Constraint)value;
		}
		
		// references
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 